package it.sd.wdc.spider.executer;

import it.sd.utility.XMLWrapper;
import it.sd.utility.XMLWrapperFactory;
import it.sd.wdc.spider.bean.PostParameters;
import it.sd.wdc.spider.htmlbrowser.WebClient;


public class ScriptSession {

	private WebClient wclient = null;
	private XMLWrapper attributes = null;
	
	public ScriptSession() throws Exception {
		this.wclient = new WebClient();
		this.attributes = XMLWrapperFactory.build("session");
	}
	
	public WebClient getWebClient() {
		return wclient;
	}
	
	public void close() {
	}

	public XMLWrapper getAttributes() {
		return attributes;
	}

	public String getPage(String host, String action, String method, PostParameters pp) throws Exception {
		return wclient.getPage(host, action, method, pp);
	}

	public void addPage(XMLWrapper xml) {
		attributes.addDoc(xml);
	}
	
	public String toString() {
		return attributes.toString();
	}
}
